<template>
  <div class="ptem">
    <div class="i6d6">
      <div class="sltem" v-for="(item,i) in value">
        <input v-model="item.label" @keyup="keyup">
        <i class="iconfont icon-close" @click="removeItem(i)"></i>
      </div>
    </div>
    <div class="i6d6 btn-group btn-group-has1">
      <a class="btn btn-default" @click="addItem()">＋ 添加选项</a>
    </div>
  </div>
</template>

<script>
export default{
  props:{
    value:{
      type:Array
    }
  },
  model:{
    prop:'value',
    event:'say-options'
  },
  methods:{
    keyup:function(){
      this.$emit('say-options',this.value)
    },
    removeItem:function(i){
      this.value.splice(i,1)
      this.$emit('say-options',this.value)
    },
    addItem:function (){
      this.value.push({label:''})
      this.$emit('say-options',this.value)
    }
  }
}
</script>

<style>
</style>